﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using PDO.DataPersistence.Core;
using PDO.DataPersistence.ServiceProvider;
using PDO.UI.Core;
using PDO.Utilities;

namespace NorthwindApp
{
    /// <summary>
    /// Interaction logic for EmployeeView.xaml
    /// </summary>
    public partial class EmployeeView : BaseView
    {
        public EmployeeView()
        {
            InitializeComponent();

            BasePM = new EmployeePM();
            DataContext = PM;
        }

        /// <summary>
        /// PresentationModel
        /// </summary>
        public EmployeePM PM
        {
            get { return base.BasePM as EmployeePM; }
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            PM.SaveAll();
        }

        private void btnAddNew_Click(object sender, RoutedEventArgs e)
        {
            PM.AddNewEmployee();
        }

        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            PM.DeleteSelectedEmployee();
        }

    }
}
